[
    async function(kuo,Context,context){    
        Context.headers["content-type"] ="text/xml; charset=UTF-8";
        this.$features = await Kuoplus("cms");
        let HCTime = Mode("Tools").Int(this.$features.configure['缓存时间']['0']);
        let HASH ="html/seo_rss";
        Context.Cache = true;
        if(HCTime  > 0){
            let neirong = await Mem.Get(HASH);
            if(neirong){
                Context.body = neirong
                return ;
            }
        }

        let $DB = await db('cms_type');
        let XML = ['<?xml version="1.0" encoding="utf-8"?>'];
      
        XML.push('<rss version="2.0">');
        XML.push('<channel>');
        let $WZID = this.$features['configure']['网站信息id']['0']?this.$features['configure']['网站信息id']['0']:1;
        if($WZID > 0){
            let $DATA = await this.TYPE_find({'id':$WZID});
            if($DATA ){
                XML.push('<title>'+$DATA['name']+'</title>');
                XML.push('<link>'+WZHOST+'</link>');
                XML.push('<description>'+$DATA['describes']+'</description>');
            
            }
        }
        let $hh = await $DB.Zhicha('off,url,atime,name,describes,content').Where({'off':2}).Select();
        if($hh){
            for(var tt in $hh){
                let $DATA = $hh[tt];
                XML.push('<item>');
                XML.push('<title>'+$DATA['name']+'</title>');
                XML.push('<link>'+KuoLink([kuo.class, $DATA['url'] ])+'</link>');
                XML.push('<description>'+( $DATA['describes'] != "" ? $DATA['describes']: ( $DATA['content'].replace(/(<([^>]+)>)/ig,"").replace(/&nbsp;/ig,"") ).substring(0,150)) +'</description>');
                XML.push('</item>');
            }
        }
        $DB = await $DB.SetTable("cms_content");
        $hh = await $DB.Zhicha('off,url,atime,name,describes,content').Where({'off':2}).Limit(1000).Select();
        if($hh){
            for(var tt in $hh){
                let $DATA = $hh[tt];
                XML.push('<item>');
                XML.push('<title>'+$DATA['name']+'</title>');
                XML.push('<link>'+KuoLink([kuo.class, $DATA['url'] ])+'</link>');
                XML.push('<description>'+( $DATA['describes'] != "" ? $DATA['describes']: ( $DATA['content'].replace(/(<([^>]+)>)/ig,"").replace(/&nbsp;/ig,"") ).substring(0,150)) +'</description>');
                XML.push('</item>');
            }
        }
        XML.push('</channel>');
        XML.push('</rss>');
        Context.body = implode("\n",XML);
        if(HCTime  > 0 && Context.Cache){
            await Mem.Set(HASH,Context.body,HCTime);
        }
    }
]